package com.cysd.ewmxns.ui.fragment

import android.content.Intent
import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.cszy.ewmxns.base.BaseVMFragment
import com.cszy.ewmxns.common.AppConstants

import com.cysd.ewmxns.ui.activity.FeedBackActivity
import com.cysd.ewmxns.ui.activity.HtmlActivity
import com.cysd.ewmxns.utils.AppUtil
import com.cysd.ewmxns.viewmodel.MainViewModel
import com.hlyj.http.ad.NewGroMoreFeedAdManager
import com.hnyyac.ad.mds.utils.BaseAdConstants
import qrrspeeelild.rqrc0ode.andro0ild.BuildConfig
import qrrspeeelild.rqrc0ode.andro0ild.databinding.FragmentWodeBinding
import okhttp3.Response


class WodeFragment : BaseVMFragment<MainViewModel, FragmentWodeBinding>() {
    private var newGromoreFeedAd : NewGroMoreFeedAdManager? =null
    override fun initView(savedInstanceState: Bundle?) {
        val app_version = AppUtil.getVersionName()
        mBinding.apply {
            appVersion.text = "App版本：${app_version}${" " +AppUtil.getChannel()}"
        }
    }

    override fun initData() {
        //启动流程
        newGromoreFeedAd = NewGroMoreFeedAdManager(requireActivity(), BaseAdConstants.FEEDAD_Id, mBinding?.fragmentContainer,62)
        newGromoreFeedAd?.loadAd()
    }

    override fun initListener() {
        mBinding.rvXieyi.setOnClickListener {
            val intent = Intent(
                requireContext(),
                HtmlActivity::class.java
            )
            intent.putExtra("url", AppConstants.User_Agreement)
            intent.putExtra("title", "用户协议")
            startActivity(intent)
        }

        mBinding.rvYinsi.setOnClickListener {
            val intent = Intent(
                requireContext(),
                HtmlActivity::class.java
            )
            intent.putExtra("url", AppConstants.Privacy_Policy)
            intent.putExtra("title", "隐私政策")
            startActivity(intent)
        }

        mBinding.rvFeedback.setOnClickListener {
            startActivity(Intent(requireContext(), FeedBackActivity::class.java))
        }

    }
}